﻿using System.Collections.Generic;
using Metro.Kashikoi.Service.Common.Entity;
using Metro.Kashikoi.Service.Storage.Business;
using Metro.Kashikoi.ServiceContract.Storage;

namespace Metro.Kashikoi.Service.Test.Storage
{
    class MockFacade : IFacade
    {
        public IUnitOfWork Context { get; private set; }
        public object Entity { get; private set; }
        public int EntityId { get; private set; }
        public StockStatus StockStatus { get;  private set; }

        public BinInventory Inventory { private get; set; }
        public IList<BinInventory> Inventories { private get; set; }

        public void CreateInventory(IUnitOfWork context, BinInventory inventory, int stockAreaId)
        {
            this.Context = context;
            this.Entity = inventory;
            this.EntityId = stockAreaId;
        }

        public void UpdateInventory(IUnitOfWork context, BinInventory inventory)
        {
            this.Context = context;
            this.Entity = inventory;
        }

        public void UpdateInventoriesStockStatus(IUnitOfWork context, ICollection<BinInventory> inventories, StockStatus stockStatus)
        {
            this.Context = context;
            this.Entity = inventories;
            this.StockStatus = stockStatus;
        }

        public void UpdateInventoryStockStatus(IUnitOfWork context, string SSID, StockStatus stockStatus)
        {
            this.Context = context;
            this.Entity = SSID;
            this.StockStatus = stockStatus;
        }

        public void DeleteInventory(IUnitOfWork context, int inventoryId)
        {
            this.Context = context;
            this.EntityId = inventoryId;
        }

        public void DeleteInventoriesOfStockAreas(IUnitOfWork context, IEnumerable<int> stockAreaIdList)
        {
            this.Context = context;
            this.Entity = stockAreaIdList;
        }

        public void DeleteInventoriesOfItems(IUnitOfWork context, IEnumerable<int> itemIdList)
        {
            this.Context = context;
            this.Entity = itemIdList;
        }

        public IList<BinInventory> GetInventoriesOfStockAreas(IUnitOfWork context, IEnumerable<int> stockAreaIdList)
        {
            this.Context = context;
            this.Entity = stockAreaIdList;
            return Inventories;
        }

        public IList<BinInventory> GetRestockList(IUnitOfWork context, IEnumerable<int> stockAreaIdList)
        {
            this.Context = context;
            this.Entity = stockAreaIdList;
            return Inventories;
        }

        public BinInventory GetInventoryById(IUnitOfWork context, int Id)
        {
            this.Context = context;
            this.EntityId = Id;
            return Inventory;
        }

        public BinInventory GetInventoryBySSID(IUnitOfWork context, string SSID)
        {
            this.Context = context;
            this.Entity = SSID;
            return Inventory;
        }

        public IList<BinInventory> GetInventoriesByItem(IUnitOfWork context, int itemId)
        {
            this.Context = context;
            this.EntityId = itemId;
            return Inventories;
        }

        public BinInventory CloneInventory(IUnitOfWork context, int inventoryId)
        {
            this.Context = context;
            this.EntityId = inventoryId;
            return Inventory;
        }

        public IList<BinInventory> CloneInventoriesOfStockArea(IUnitOfWork context, int fromStockAreaId, int toStockAreaId)
        {
            this.Context = context;
            this.Entity = fromStockAreaId;
            this.EntityId = toStockAreaId;
            return this.Inventories;
        }
    }
}
